class Solution(object):
    def suggestedProducts(self, products, searchWord):
        products.sort()
        out = []
        m = len(searchWord)
        for k in range(m):
            next_pro = []
            for word in products:
                if len(word) > k and word[k] == searchWord[k]:
                    next_pro.append(word)
            products = next_pro
            out.append(products[:3])
        return out